/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.bsd5ex.group1.kaokang.helper;

import com.bsd5ex.group1.kaokang.dao.UnitTypeDAO;
import com.bsd5ex.group1.kaokang.model.UnitType;

/**
 *
 * @author IBIAINIKI
 */
public class UnitTransferHelper {
    
    public float getLiteRatio(float ratio, int unitTypeID){
        UnitTypeDAO unitTypeDAO = new UnitTypeDAO();
        return getLiteRatio(ratio, unitTypeDAO.getUnitTypeByID(unitTypeID));
    }
    
    public float getLiteRatio(float ratio, UnitType unitType){
        if(unitType == null){
            return 0;
        }
        return ratio * unitType.getUnitTransfer().getUnitPerLitre();
    }
    
}
